<?php
include('db-connection'.DIRECTORY_SEPARATOR.'conn.php');

$userName = $_REQUEST["email"];
$Password = $_REQUEST["password"];

$sql = "SELECT COUNT(*) as cntUser, int_role_assigned, int_user_id FROM tbl_user_master WHERE txt_user_name='".$userName."' AND txt_password='".md5($Password)."' AND yn_is_active='Y' AND yn_is_deleted='N' group by int_role_assigned ";
echo $sql;
$run = mysql_query($sql);
		while ($data = mysql_fetch_array($run))
		{
			$arrDataAdmin["count"] = $data['cntUser'];
			$arrDataAdmin["role"] = $data['int_role_assigned'];
			$arrDataAdmin["userid"] = $data["int_user_id"];
		}
		if($arrDataAdmin["count"]=="1")
		{
			session_start();
			$role = $arrDataAdmin["role"];
			$_SESSION["UserName"] = $userName;
			$_SESSION["Role"] = $role;
			$_SESSION["userid"] = $arrDataAdmin["userid"];
			
			//header("Location:admin/admin-homepage.php");
		}
		else
		{
			$role="0";
			echo "0";
		}


?>